from qiniu import Auth


class Qiniu():
    def __init__(self):
        # 需要填写你的 Access Key 和 Secret Key
        self.access_key = 'XOu92azviBkzvw7aSZX6YeSLs0_2vxMenc_o9up0'
        self.secret_key = '4Smv3owlcLNIztBYjY-pjo4O4MD11hZdCFcrdUwb'

    def qiniu_token(self):
        # -*- coding: utf-8 -*-

        # 构建鉴权对象
        q = Auth(self.access_key, self.secret_key)

        # 要上传的空间
        bucket_name = 'wyh2503a'

        # 3600为token过期时间，秒为单位。3600等于一小时
        token = q.upload_token(bucket_name)

        return token



qn = Qiniu()
